package com.luke.star.controller;

import java.util.ArrayList;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.luke.star.bean.StReportReq;
import com.luke.star.bean.StTaskNoteVo;
import com.luke.star.serviceImpl.StReportService;

import lombok.extern.slf4j.Slf4j;

@Slf4j
@Controller
public class StReportController {

	@Resource
	private StReportService stReportService;
	
	@RequestMapping(value="/reportData",produces = "text/html;charset=UTF-8")
	@ResponseBody
	public String queryTaskByPage(StReportReq req){
		log.info("开始处理任务查询请求");
		List<StTaskNoteVo> queryReportData;
		try {
			queryReportData = stReportService.queryReportData(req);
		} catch (Exception e) {
			log.error("查询报表数据错误---,",e);
			queryReportData = new ArrayList<>();
		}

		return JSON.toJSONString(queryReportData,SerializerFeature.WriteNullStringAsEmpty);
	}
}
